﻿@{
    ViewBag.Title = "Competence";
    Layout = "~/Views/Shared/_Main.cshtml";
}
<script type="text/javascript" src="/Res/MyJs.js"></script>
<script type="text/javascript" src="../"></script>
<style type="text/css">
    .CompeMain
    {
        width: 500px;
        border: lightskyblue 1px solid;
    }
    .Competop
    {
        width: 100%;
        height: 60px;
    }
    .Compeleft
    {
        width: 100%;
        height: 400px;
        float: left;
        border: lightskyblue 1px solid;
        overflow-y: scroll;
    }
</style>
<script>
    function back() {
        window.location.href = "/SysRole/RoleList";
    }
    function onSave() {
        var nodes = $('#tt2').tree('getChecked');
        var s = '';
        for (var i = 0; i < nodes.length; i++) {
            if (s != '') s += ',';
            s += nodes[i].id;
        }
        $.post("/SysRole/SaveCompetence?strs=" + encodeURI(s), function (res) {
            if (res == "OK") {
                alert("操作成功！");
                goto("/SysRole/RoleList");
            } else
                alert(res);
        });
    }
</script>
<div style="margin: 5px;">
    <div id="p" class="easyui-panel" style="width: 520px; padding: 10px 5px 10px 5px;"
        data-options="title:'权限列表',iconCls:'icon-edit'">
        <table style="width: 100%">
            <tr>
                <td style="text-align: right">
                    <input type="button" value="保存" onclick="onSave()" />
                    <input class="submitcss" type="button" onclick="back()" value="返回" />
                </td>
            </tr>
        </table>
        <div style="margin-top: 5px;" class="Compeleft">
            <ul id="tt2" class="easyui-tree" data-options="url:'/SysRole/GetTree',checkbox:true,
			onClick: function(node){
				$(this).tree('toggle', node.target);
			},
			onContextMenu: function(e,node){
				e.preventDefault();
				$(this).tree('select',node.target);
				$('#mm').menu('show',{
					left: e.pageX,
					top: e.pageY
				});
			}">
            </ul>
        </div>
    </div>
</div>
